function createStore (reducer,prevState) {
    let list =[]
    
    let state = prevState

    function subsceibe(callback){
        list.push(callback)
    }

    function dispatch(action){
        state = reducer(state,action)
        for(let i in list){
            list[i]&&list[i]()
        }
    }

    function getState(){
        return state
    }

    return{
        subsceibe,
        dispatch,
        getState
    }
}